<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <div>
        <h1>The Jquery Ajax 01 Page</h1>
        <button onclick="doAjax()">$.ajax(....)</button>
        <button onclick="doGet()">$.get(...)</button>
        <button onclick="doPost()">$.post(...)</button>
        <button onclick="doLoad()">$(...).load("...")</button>
    </div>
    <div id="result"></div>
    <script src="/js/jquery.min.js"></script>
    <script>
        function doLoad(){
            let requestUrl="/doAjaxGet";
            //load函数会在指定位置通过ajax方法加载数据,并将数据更新到这个位置
            $("#result").load(requestUrl,function(){//可选
                console.log("==load complete==");//加载完成以后执行
            });
        }
        function doPost(){
            let requestUrl="/doAjaxPost";
            let params="id=104&city=shijiazhuang";
            $.post(requestUrl,params,function (result){
                alert(result);
            });
        }
        function doGet(){
            let requestUrl="/doAjaxGet";
            let params="";
            $.get(requestUrl,params,function (result){
                $("#result").html(result);
            },"text");
        }
        function doAjax(){
            let requestUrl="/doAjaxGet";
            let params="";
            $.ajax({
                url:requestUrl,
                date:params,
               // method:"GET",
                dataType:"text",
                success:function (result){
                  $("#result").html(result);
                }
            });
        }
    </script>
</body>
</html>